﻿
using Microsoft.AspNetCore.NodeServices;
using System.Threading.Tasks;

namespace WebApplication1.Node
{
    public class Des
    {
        private INodeServices nodeServices;



        public Des(INodeServices nodeServices)
        {
            this.nodeServices = nodeServices;
        }



        public async Task<string> EncryptDES(string data, string key, int iv)
        {
            var result = await nodeServices.InvokeExportAsync<string>("./Node/cryptUtil", "encrypt", data, key, iv);
            return result;
        }



        public async Task<string> DecryptDES(string data, string key, int vi)
        {
            var result = await nodeServices.InvokeExportAsync<string>("./Node/cryptUtil", "decrypt", data, key, vi);
            return result;
        }
    }
}
